/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package trefliq.EJB.webservice;

import java.util.List;
import javax.ejb.EJB;
import javax.jws.WebService;
import javax.ejb.Stateless;
import javax.jws.Oneway;
import javax.jws.WebMethod;
import javax.jws.WebParam;
import trefliq.EJB.entities.Genre;
import trefliq.EJB.sessionbeans.GenreBean;

/**
 *
 * @author Yash
 */
//@WebService(serviceName = "GenreWebService")
@Stateless()
public class GenreWebService {
    @EJB
    private GenreBean ejbRef;// Add business logic below. (Right-click in editor and choose
    // "Insert Code > Add Web Service Operation")

    @WebMethod(operationName = "create")
    @Oneway
    public void create(@WebParam(name = "entity") Genre entity) {
        ejbRef.create(entity);
    }

    @WebMethod(operationName = "edit")
    @Oneway
    public void edit(@WebParam(name = "entity") Genre entity) {
        ejbRef.edit(entity);
    }

    @WebMethod(operationName = "remove")
    @Oneway
    public void remove(@WebParam(name = "entity") Genre entity) {
        ejbRef.remove(entity);
    }

    @WebMethod(operationName = "find")
    public Genre find(@WebParam(name = "id") Object id) {
        return ejbRef.find(id);
    }

    @WebMethod(operationName = "findAll")
    public List<Genre> findAll() {
        return ejbRef.findAll();
    }

    @WebMethod(operationName = "findRange")
    public List<Genre> findRange(@WebParam(name = "range") int[] range) {
        return ejbRef.findRange(range);
    }

    @WebMethod(operationName = "count")
    public int count() {
        return ejbRef.count();
    }

    @WebMethod(operationName = "createGenre")
    public boolean createGenre(@WebParam(name = "genre") String genre) {
        return ejbRef.createGenre(genre);
    }

    @WebMethod(operationName = "getAllGenre")
    public List<Genre> getAllGenre() {
        return ejbRef.getAllGenre();
    }

    @WebMethod(operationName = "getGenreById")
    public Genre getGenreById(@WebParam(name = "id") Long id) {
        return ejbRef.getGenreById(id);
    }

    @WebMethod(operationName = "deleteGenreByName")
    @Oneway
    public void deleteGenreByName(@WebParam(name = "gName") String gName) {
        ejbRef.deleteGenreByName(gName);
    }

    @WebMethod(operationName = "updateGenreByName")
    @Oneway
    public void updateGenreByName(@WebParam(name = "oldName") String oldName, @WebParam(name = "newName") String newName) {
        ejbRef.updateGenreByName(oldName, newName);
    }
    
}
